﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using ScenarioFramework.WorkflowEngine.Database.WorkflowProcesses;
using ScenarioFramework.WorkflowEngine.DataBase;

namespace ScenarioFramework.Portal.SF.Reports.UserControls
{
    public partial class BAMActivities : System.Web.UI.UserControl
    {
        #region Attributes to choise Statement and filter
        public string Statement = string.Empty;
        public long ProcessId = 0;
        public string ProcessName = string.Empty;
        public string ActivityId = string.Empty;
        #endregion

        Activity activity = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            activity = new Activity();
            if (Request.QueryString["ProcessId"] != null)
                activity.ProcessId = long.Parse(Request.QueryString["ProcessId"]);
            if (Request.QueryString["ActivityId"] != null)
                activity.ActivityId = Request.QueryString["ActivityId"];
            if (Request.QueryString["Statement"] != null)
                Statement = Request.QueryString["Statement"];
            if (Request.QueryString["ProcessName"] != null)
                activity.ProcessName  = Request.QueryString["ProcessName"];

            if (Statement.CompareTo(String.Empty) == 0)
                this.GridView1.DataSource = Helpers.ActivityHelper().SelectAllActivities();
            else
                this.GridView1.DataSource = Helpers.ActivityHelper().Select(Statement, activity);

            this.GridView1.DataBind();
        }
    }
}